<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>窗口加载与卸载事件</title>
</head>
<body>
<h1>load:窗口加载事件，当页面加载完毕后触发</h1>
<h1>unload:窗口卸载事件，当页面关闭时触发</h1>
<h1>document.DomContentLoaded:在文档加载完成时就触发</h1>
<h1>resize:用户正在调整浏览器窗口大小时出发</h1>

<script>
  window.onload=function (){
    alert('加载完成!')
  }
  window.onunload=function (){
    location.assign('https://www.gitee.com/realsshwer');
  }
  window.onresize=function (){
      console.log('resized');
  }
</script>
</body>
</html>